<?php
namespace Amis\dataviewer;

use Amis\Basics\AmisBasics;

class Code extends AmisBasics
{
    public string $type = 'code';

    public function className(string $className)
    {
        $this->className = $className;
        return $this;
    }

    /**
     * 显示的颜色值
     * @param string $value
     * @return $this
     */
    public function value(string $value)
    {
        $this->value = $value;
        return $this;
    }

    /**
     * 在其他组件中，时，用作变量映射
     * @param string $name
     * @return $this
     */
    public function name(string $name)
    {
        $this->name = $name;
        return $this;
    }

    /**
     * 所使用的高亮语言，默认是 plaintext
     * @param string $language
     * @return $this
     */
    public function language(string $language)
    {
        $this->language = $language;
        return $this;
    }

    /**
     * 默认 tab 大小 4
     * @param int $tabSize
     * @return $this
     */
    public function tabSize(int $tabSize = 4)
    {
        $this->tabSize = $tabSize;
        return $this;
    }

    /**
     * 主题，还有 'vs-dark'
     * @param string $editorTheme
     * @return $this
     */
    public function editorTheme(string $editorTheme = 'vs')
    {
        $this->editorTheme = $editorTheme;
        return $this;
    }

    /**
     * 是否折行
     * @param bool $wordWrap
     * @return $this
     */
    public function wordWrap(bool $wordWrap = true)
    {
        $this->wordWrap = $wordWrap;
        return $this;
    }
}